package com.handpay.nocardpay.baselibrary.logutils;

import android.util.Log;


import java.util.Date;

public class ConsoleLogger implements ILogger {
    private boolean isDebug;

    public void setDebug(boolean debug) {
        this.isDebug = debug;
    }

    public void log(int level, Date date, String area, String message) {
        if (!isDebug) {
            return;
        }
        String text = DateTimeUtility.getDateTimeString(date) + " " + message;
        switch (level) {
            case LogLevel.DEBUG:
                Log.d(area, text);
                break;
            case LogLevel.INFO:
                Log.i(area, text);
                break;
            case LogLevel.WARNING:
                Log.w(area, text);
                break;
            case LogLevel.ERROR:
                Log.e(area, text);
                break;
            default:
                Log.d(area, text);
                break;
        }
    }
}